﻿/*******************************************************************************
 * Copyright © 2017 FriendStar.Framework 版权所有
 * Author: FZH
 * Description: FriendStar快速开发平台
 * Website：http://www.FriendStar.cn
*********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using SqlSugarRepository;
using FriendStar.Code;
using FriendStar.Domain.Entity.MainData;
using FriendStar.Domain.IRepository.MainData;
using FriendStar.Repository.MainData;

namespace FriendStar.Application.MainData
{
    /// <summary>
	/// 数据视图 V_CPK_ZD_12_DatStoreHouseSet 对应的数据应用功能类。
	/// </summary>
	public class V_CPK_ZD_12_DatStoreHouseSetApp
    {       
        private string UseUnit = Configs.GetValue("UseUnit");  

        private IV_CPK_ZD_12_DatStoreHouseSetRepository service = new V_CPK_ZD_12_DatStoreHouseSetRepository();

        public List<V_CPK_ZD_12_DatStoreHouseSetEntity> GetList(Pagination pagination, string FStoreName, string FStoreSetNO)
        {
            var expression = ExtLinq.True<V_CPK_ZD_12_DatStoreHouseSetEntity>();
            expression = expression.And(t => t.UseUnit == UseUnit);
            if (!string.IsNullOrEmpty(FStoreName))
            {
                expression = expression.And(t => t.FStoreName.Contains(FStoreName));
            }
            if (!string.IsNullOrEmpty(FStoreSetNO))
            {
                expression = expression.And(t => t.FStoreSetNO.Contains(FStoreSetNO));
            }
            return service.FindList(expression, pagination);
        }

        public V_CPK_ZD_12_DatStoreHouseSetEntity GetForm(string keyValue)
        {
            return service.FindEntity(keyValue);
        }
    }
}